home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / sectools / dsniff / decode_ftp.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-16  |  733 b   |  41 lines

  1. /*
  2.   decode_ftp.c
  3.  
  4.   File Transfer Protocol.
  5.   
  6.   Copyright (c) 2000 Dug Song <dugsong@monkey.org>
  7.  
  8.   $Id: decode_ftp.c,v 1.1 2000/05/16 17:31:14 dugsong Exp $
  9. */
  10.  
  11. #include <sys/types.h>
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include "options.h"
  15. #include "decode.h"
  16.  
  17. int
  18. decode_ftp(u_char *buf, int len)
  19. {
  20.     char *p;
  21.     
  22.     Buf[0] = '\0';
  23.  
  24.     if (!strip_telopts(buf, len))
  25.         return (0);
  26.     
  27.     for (p = strtok(buf, "\r\n"); p != NULL; p = strtok(NULL, "\r\n")) {
  28.         if (strncasecmp(p, "USER ", 5) == 0 ||
  29.             strncasecmp(p, "ACCT ", 5) == 0 ||
  30.             strncasecmp(p, "PASS ", 5) == 0) {
  31.             strlcat(Buf, p, sizeof(Buf));
  32.             strlcat(Buf, "\n", sizeof(Buf));
  33.         }
  34.     }
  35.     if (strip_lines(Buf, Opt_lines) < 2)
  36.         return (0);
  37.     
  38.     return (strlen(Buf));
  39. }
  40.  
  41.